import os


def main():
    names = readfile()
    for n in names:
        ns = n.split("-")
        n1 = str(ns[0]).strip()
        if len(ns) > 2:
            n2 = str(ns[1]).strip() + str(ns[2]).strip()
        else:
            n2 = str(ns[1]).strip()
        filename = "Y:\\newdown\\emu\\PS中文游戏\\" + n1 + ".zip"
        newfilename = "Y:\\newdown\\emu\\PS中文游戏\\" + n2 + ".zip"
        print(filename)
        print(newfilename)
        print(os.path.exists(filename))
        if os.path.exists(filename):
            try:
                os.rename(filename, newfilename)
            finally:
                pass


def readfile():
    with open(r"Y:\newdown\emu\PS中文游戏\name.txt", "r", encoding='UTF-8') as f:
        ns = []
        names = f.readlines()
        for n in names:
            ns.append(str(n).strip())

        nss = set(sorted(ns, key=lambda x: x.encode('utf-8')))
        return list(nss)


if __name__ == "__main__":
    main()
